package com.zhouixi.reproduce.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhouixi.reproduce.utils.DistributedLockUtil;
import com.zhouixi.reproduce.utils.RedisUtil;
import cn.hutool.core.date.DateTime;


@Controller
@ResponseBody
public class SeckillController {
	

	@Autowired
	private RedisUtil redis;
	
	@Autowired
	private DistributedLockUtil loclUtil;
	
	@RequestMapping("/seckill")
	public void Seckill() {
		
		System.out.println(Thread.currentThread().getName() + "-----" + DateTime.now());
		long timeoutSecond = 100l;
		String key = "redis_lock_key";
		System.out.println(loclUtil.lock(key, timeoutSecond));
	}

}
